Dim scr&
Randomize Timer: screen _NewImage(800, 720, 32)
Dim amt As Integer: amt = 3337 ' ammount of vehicles (amount) =)
_display
Type Code
x As Single ' particle x-pos
y As Single ' particle y-pos
s As Single ' particle speed
d As Integer '
e As Integer '
f As Integer '
g As Integer ' integers = node
h As Integer ' using several to
i As Integer ' "force" individual
j As Integer ' random behaviour(??)
End Type
Dim Shared code(1 To amt) As Code
For w = 1 To amt
code(w).x = 0
code(w).y = 360
code(w).s = Rnd * .77 + .22
code(w).d = Int(Rnd * 2)
code(w).e = Int(Rnd * 2)
code(w).f = Int(Rnd * 2)
code(w).g = Int(Rnd * 2)
code(w).h = Int(Rnd * 2)
code(w).i = Int(Rnd * 2)
code(w).j = Int(Rnd * 2)
Next w
Do
Cls
For w = 1 To amt
CIRCLE (code(w).x, code(w).y), 1, _RGB(255, 255, 0), , , , F
code(w).x = code(w).x + code(w).s
If code(w).x <= 100 Then
If code(w).x > 50 Then 'first intersection
If code(w).d = 1 Then code(w).y = code(w).y - code(w).s
If code(w).d = 0 Then code(w).y = code(w).y + code(w).s
End If
End If
If code(w).x <= 150 Then
If code(w).x > 100 Then 'second intersection.. etc etc
If code(w).e = 1 Then code(w).y = code(w).y - code(w).s
If code(w).e = 0 Then code(w).y = code(w).y + code(w).s
End If
End If
'skipsecond: ' as you can see this is where it turns into spaghetti
If code(w).x <= 200 Then
If code(w).x > 150 Then
If code(w).f = 1 Then code(w).y = code(w).y - code(w).s
If code(w).f = 0 Then code(w).y = code(w).y + code(w).s
End If
End If
'skipthird:
If code(w).x <= 250 Then
If code(w).x > 200 Then
If code(w).g = 1 Then code(w).y = code(w).y - code(w).s
If code(w).g = 0 Then code(w).y = code(w).y + code(w).s
End If
End If
'skipfourth:
If code(w).x <= 300 Then
If code(w).x > 250 Then
If code(w).h = 1 Then code(w).y = code(w).y - code(w).s
If code(w).h = 0 Then code(w).y = code(w).y + code(w).s
End If
End If
If code(w).x <= 350 Then
If code(w).x > 300 Then
If code(w).i = 1 Then code(w).y = code(w).y - code(w).s
If code(w).i = 0 Then code(w).y = code(w).y + code(w).s
End If
End If
If code(w).x > 350 Then
If code(w).j = 1 Then code(w).y = code(w).y - code(w).s
If code(w).j = 0 Then code(w).y = code(w).y + code(w).s
End If
'keeping the particles from leaving screen
If code(w).x > 400 And code(w).y < 10 Then
code(w).x = code(w).x + code(w).s
code(w).y = 10
End If
If code(w).x > 400 And code(w).y > 710 Then
code(w).x = code(w).x + code(w).s
code(w).y = 710
End If
' this moves particles back to left side
If code(w).x > 720 Then code(w).y = 360
If code(w).x > 720 Then code(w).x = 0
Next w
_Display
Loop